package com.climber.controller;

import com.climber.dao.BookDao;
import com.climber.pojo.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller
public class BookController {
    @Autowired
    private BookDao bookDao;

    public void findBookById(int id){
        Book book = bookDao.selectBookById(id);
        System.out.println(book.toString());
    }

    public void findAllBook(){
        List<Book> books = bookDao.selectAllBook();
        books.forEach(book-> System.out.println(book.toString()));
    }

    public void addBook(){
        Book book=new Book(null,"name1","au1");
        System.out.println(bookDao.addBook(book));
    }



}
